import ExamStatus from '@/components/type-of-exam/types/exam-status';
import { Blank, Choose } from '.';

/** 题 */
export class ExamItem {
  /**
   * 当前题目要填的空的信息列表
   */
  public blanks?: Blank[] = [];

  /**
   * 题目内容
   */
  public content? = '';
  /**
   * 当前题目唯一标识
   */
  public detailsId? = '';

  /**
   * 当前题目选项信息列表
   */
  public options?: Choose[] = [];

  /**
   * 当前题目所属问卷唯一标识
   */
  public queId? = '';

  /**
   * 题干
   */
  public title? = '标题';

  /**
   * 所属题型id
   */
  public typeId = 0;

  /**
   * 所属题型名称
   */
  public typeName = '';

  // ================== 扩展

  /**
   * 是否是可编辑
   */
  public edit = false;

  /**
   * 题号 从1开始
   */
  public questNum = 0;

  /**
   * 题目状态
   */
  public status = ExamStatus.Basic;

  /** 是否是必选 */
  public require = true;

  // ================== 扩展 统计
  /**作答填空 */
  public blankInfos?: Array<Blank>;

  /** 作答选择 */
  public chooseInfos?: Array<Choose>;

  /**
   * 实例
   * @param typeId
   * @param typeName
   * @param edit
   * @param questNum
   * @param blanks 填空
   * @param options 选择
   */
  constructor(
    typeId = 0,
    typeName = '',
    edit = false,
    questNum = 0,
    blanks?: Blank[],
    options?: Choose[],
  ) {
    this.typeId = typeId;
    this.typeName = typeName;
    this.edit = edit;
    this.questNum = questNum;
    this.blanks = blanks;
    this.options = options;
  }
  // 回答
  public answerChose: string | string[] = '';
}
